package com.demo2.controller;

import com.demo2.service.ServiceStudent;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Controller;

@Controller
public class SayHiCt {

//    @Bean(name = "HiController")
//    public void sayHi() {
//        System.out.println("Hi, Controller!");
//    }
//
//    @Bean(name = "HiChina")
//    public String getChina() {
//        return "Hi! China!";
//    }

    @Autowired
    private ServiceStudent student;

    @Bean(name = "stu1")
    public String getStudent1() {
        String str = student.getService();
        if(str != null) {
            return str;
        }
        return "I am student1 !";
    }

    @Bean(name = "stu2")
    public String getStudent2() {
        return "I am student2 !";
    }

    @Bean(name = "stu3")
    public String getStudent3() {
        return "I am student3 !";
    }
}
